<?
include("session.php");
?>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<script type="text/javascript" src="../webkit/utils/jquery.js"></script>
<script type="text/javascript" src="../webkit/utils/form.checker.js"></script>
<link type="text/css" rel="stylesheet" href="page.css"/> 
<body  bgcolor="#f4f4f4" style="margin:0px;" scroll=no>


	<table width=99% cellpadding=3 cellspacing=1 bgcolor="#dddddd">
		<tr bgcolor="white">
			<td align=right>取消原因</td><td align=left><select id="cancel_reason"><option value=''>-为什么-</option><option value='1'>定单填写错误</option><option value='2'>暂时不想买了</option><option value='3'>配送延时问题</option><option value='4'>其它服务问题</option></select></td>
		</tr>
		<tr bgcolor="white">
			<td align=right  width=20%>备注说明</td><td align=left width=70%><textarea class="input_text" id="cancel_desc" style="width:260px; height:90px" rows=5></textarea></td>
		</tr>
		<tr bgcolor="white">
			<td align=right>&nbsp;</td><td align=left><input type="button" id="btn_save" value="确定取消">　<input type="button" onclick="parent.closeDlg()" value="关闭窗口" style='color:gray'></td>
		</tr>
	</table>

	
	<script>
		$("#btn_save").click(
			function() {
				if( $("#cancel_reason").val() == "" || $("#address").val() == "") {
					alert("请选择取消定单的原因！");
					return false;
				}
				var params = {'cancel_reason':$("#cancel_reason").val(), 'cancel_desc':$("#cancel_desc").val()}
				if(confirm("确认申请取消定单吗？")) {
					$.post("order_query.php?action=cancel_order&id=<?echo $_GET['order_id']?>", params, function(data) {
						if(data == "ok") {
							alert("定单已成功申请取消！");
							parent.refreshGrid();
							parent.closeDlg();
						}
					});
				}
			}
		);


		$(function() {
			$.get("order_query.php?action=get_by_id&id=<?echo $_GET['order_id']?>", function(data){
				eval("var row = "+data);
				$('#cancel_reason').val(row['cancel_reason']);
				$('#cancel_desc').val(row['cancel_desc']);
			});
		});
	</script>
</body>
</html>